﻿
using System;
using System.Data;
using System.IO;
using System.Web;
using System.Web.UI.WebControls;
using JumbotCms.Common;
namespace JumbotCms.WebFile.Admin
{#foreach($u in $TableInfos)
    public partial class ${u.TabName}edit : JumbotCms.UI.AdminCenter
    {
        private string pid = string.Empty;
        protected void Page_Load(object sender, EventArgs e)
        {
            Admin_Load("0000", "html");
            id = Str2Str(q("id"));
           
            JumbotCms.DBUtility.WebFormHandler wh = new JumbotCms.DBUtility.WebFormHandler(doh, "${u.TabName}", btnSave);
#foreach($c in $u.ColumnInfos)
			wh.AddBind(txt${c.ColumnName}, "${c.ColumnName}", true);
#end
#end
            if (id == "0")
            {
                string pid = Str2Str(q("pid"));
                txtzxftId.Text = pid;
                wh.Mode = JumbotCms.DBUtility.OperationType.Add;
            }
            else
            {
                wh.ConditionExpress = "id=" + id;
                wh.Mode = JumbotCms.DBUtility.OperationType.Modify;
            }
            wh.BindBeforeAddOk += new EventHandler(bind_ok);
            wh.BindBeforeModifyOk += new EventHandler(bind_ok);
            wh.AddOk += new EventHandler(save_ok);
            wh.ModifyOk += new EventHandler(save_ok);
            wh.validator = chkForm;
        }
        protected void bind_ok(object sender, EventArgs e)
        {

           

        }
        protected bool chkForm()
        {
            if (!CheckFormUrl())
                return false;
            if (!Page.IsValid)
                return false;
            return true;
        }
        protected void save_ok(object sender, EventArgs e)
        {

            FinalMessage("正确保存!", site.Dir + "admin/close.htm", 0);
           // FinalMessage("成功保存", site.Dir + "admin/close.htm", 0);
        }
    }
}
